<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/head::common_head('首页')"></head>
<link rel="stylesheet"
	href="http://cdn.staticfile.org/codemirror/5.40.2/codemirror.min.css">
<script type="text/javascript"
	src="http://cdn.staticfile.org/codemirror/5.40.2/codemirror.min.js"></script>
<script type="text/javascript"
	src="http://cdn.staticfile.org/codemirror/5.40.2/mode/htmlmixed/htmlmixed.min.js"></script>
<script type="text/javascript"
	src="http://cdn.staticfile.org/codemirror/5.40.2/mode/css/css.min.js"></script>
<script type="text/javascript"
	src="http://cdn.staticfile.org/codemirror/5.40.2/mode/javascript/javascript.min.js"></script>
<script type="text/javascript"
	src="http://cdn.staticfile.org/codemirror/5.40.2/mode/xml/xml.min.js"></script>
<script type="text/javascript"
	src="http://cdn.staticfile.org/codemirror/5.40.2/addon/edit/closetag.min.js"></script>
<script type="text/javascript"
	src="http://cdn.staticfile.org/codemirror/5.40.2/addon/edit/closebrackets.min.js"></script>
<style>
.container {
	width: 1650px;
	padding-right: 5px;
	padding-left: 5px;
	margin-right: auto;
	margin-left: auto
}

.CodeMirror pre {
	/* Reset some styles that the rest of the page might have set */
	-moz-border-radius: 0;
	-webkit-border-radius: 0;
	border-radius: 0;
	border-width: 0;
	background: transparent;
	font-family: inherit;
	font-size: inherit;
	margin: 0;
	max-width: 680px;
	/*	white-space: pre;white-space: pre-wrap;CodeMirror cm-s-default */
	line-height: inherit;
	color: inherit;
	z-index: 2;
	position: relative;
	overflow: visible;
	-webkit-tap-highlight-color: transparent;
	-webkit-font-variant-ligatures: contextual;
	font-variant-ligatures: contextual;
}

#iframeResult {
	display: block;
	overflow: hidden;
	border: 0 !important;
	min-width: 100px;
	width: 100%;
	min-height: 300px;
	background-color: #fff
}

@media screen and (max-width:768px) {
	.CodeMirror {
		font-family: Menlo, Monaco, Consolas, "Andale Mono", "lucida console",
			"Courier New", monospace;
	}
	#iframeResult {
		height: 300px
	}
	.form-inline {
		padding: 6px 0 2px 0
	}
}
</style>
<body>
	<div class="main-content">
		<form id="submitForm" class="form-horizontal">
			<input name="id" type="hidden" class="form-control" id="id"
				th:value="${entity.id}" /> <input name="modify" type="hidden"
				class="form-control" id="modify" th:value="${entity.modify}" />
			<input name="tempVersion" type="hidden" class="form-control"
				id="tempVersion" th:value="${entity.tempVersion}" />
			<input type="hidden" id="signJson" th:value="${signJson}" />
			<table class="table table-bordered table-hover no-margins">
				<tr>
					<td class="gray-bg text-right" width="8%">模板名称<span
						style="color: red;">*</span>：
					</td>
					<td width="17%"><input class="form-control" id="tempName"
						name="tempName" required th:value="${entity.tempName}"
						th:disabled="${entity.modify}" /></td>
					<td class="gray-bg text-right" width="8%">模板编码<span
						style="color: red;">*</span>：
					</td>
					<td width="17%"><input class="form-control" id="tempCode"
						name="tempCode" required th:value="${entity.tempCode}"
						th:disabled="${entity.modify}" /></td>
					<td class="gray-bg text-right" width="8%">模板类型<span
						style="color: red;">*</span>：
					</td>
					<td width="17%"><select class="form-control" id="tempType"
						name="tempType" required th:disabled="${entity.modify}">
							<option value=''>请选择模板类型</option>
							<option th:selected="${entity.tempType eq option.code}"
								th:each="option : ${tempTypes}" th:value="${option.code}"
								th:text="${option.code}+'-'+${option.name}"></option>
					</select></td>
					<td class="gray-bg text-right" width="8%">模板版本：</td>
					<td th:text="${entity.tempVersion}" width="17%">1</td>
				</tr>
				<tr>
					<td class="gray-bg text-right">生成方式：</td>
					<td><select class="form-control" id="genModel" name="genModel"
						required>
							<option value=''>请选择生成方式</option>
							<option th:selected="${entity.genModel eq option.code}"
								th:each="option : ${genModels}" th:value="${option.code}"
								th:text="${option.name}"></option>
					</select></td>
					<td class="gray-bg text-right">绑定参数：</td>
					<td colspan="5"><select
						class="form-control noselect2 selectpicker"
						data-none-selected-text="请选择" multiple>
							<optgroup th:each="option : ${paramMaps}"
								th:label="${option.key}" label="--请选择--">
								<option th:each="value : ${option.value}"
									th:value="${value.key}" th:text="${value.value}"
									th:selected="${#lists.contains(entity.paramIds, value.key)}"></option>
							</optgroup>
					</select></td>
				</tr>

				<!-- th:if="${entity.genModel=='DOC' or entity.genModel=='PDF'}" -->
				<tr id="filetr">
					<td class="gray-bg text-right">模板上传：</td>
					<td colspan="7">
						<div class="input-group">
							<span class="input-group-btn">
								<button class="btn btn-default btn-info" type="button"
									id="inputFile">文件上传</button>
							</span> <input style="width: 600px;" type="text" disabled="disabled"
								class="form-control" id="fastUrl" name="fastUrl"
								th:value="${entity.fastUrl}" /> <span class="input-group-addon"><a
								th:href="${entity.fastPath}" id="fastPath" target='_blank'>下载</a></span>
						</div>
					</td>
				</tr>
				<!-- th:if="${entity.genModel=='HTML'}" -->
				<tr>
					<td colspan="8" class="gray-bg">
						<div class="table-box">
							<div id="toolbar">
								<button id="signAdds" type="button" class="btn btn-default">增加签名</button>
								<button id="signGet" type="button" class="btn btn-default">获取签名</button>
							</div>
							<table id="signTables"></table>
						</div>
					</td>
				</tr>
				<tr id="htmltr">
					<td colspan="8">
						<div class="container">
							<div class="col-sm-6">
								<div class="panel panel-default">
									<div class="panel-heading">
										<div class="row">
											<div class="col-xs-6">
												<button type="button" onclick="resetCode()"
													class="btn btn-default">模板样例</button>
												<button type="button" class="btn btn-default" id="inputCode">选择导入文件</button>
											</div>
											<div class="col-xs-6 text-right">
												<button type="button" class="btn btn-success"
													onclick="submitTryit()" id="submitBTN">
													<span class="fa fa-check"></span> 点击运行
												</button>
											</div>
										</div>
									</div>
									<div class="panel-body">
										<textarea class="form-control" id="htmlText" wrap="hard"
											name="htmlText" th:text="${entity.htmlText}"></textarea>
									</div>
								</div>
							</div>
							<div class="col-sm-6">
								<div class="panel panel-default">
									<div class="panel-heading">
										<button type="button" class="btn btn-default">运行结果</button>
									</div>
									<div class="panel-body">
										<div id="iframewrapper"></div>
									</div>
								</div>
							</div>
						</div>
					</td>
				</tr>
				</tbody>
			</table>
			<br>
			<div class="row">
				<div class="col-sm-offset-5 col-sm-8 text-center">
					<button id="saveBtn" type="button" class="btn btn-sm btn-info">
						<i class="fa fa-info"> </i> 保 存
					</button>
					<button id="submitBtn" type="submit" class="btn btn-sm btn-primary">
						<i class="fa fa-check"> </i> 提 交
					</button>
				</div>
			</div>
		</form>
	</div>
	<div th:include="common/script::common_script"></div>
	<div th:include="common/validate::validate_script"></div>
	<div th:include="common/codemirror::codemirror_script"></div>
	<script type="text/javascript"
		th:src="@{/static/js/module/template/html/edit.js}"></script>
</body>
</html>
